<template>
	<view>
		<view>打开地图后选中位置，可返回详细信息</view>
		<button style="margin-top: 40rpx;" type="default" @click="openMap">打开地图</button>
		<view>位置名称：{{ whereinfo.name }}</view>
		<view>详细地址：{{ whereinfo.address }}</view>
		<view>纬度：{{ whereinfo.latitude }}</view>
		<view>经度：{{ whereinfo.longitude }}</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			whereinfo:{}
		};
	},
	onShow() {},
	computed: {},
	methods: {
		openMap(){
			let _this = this;
			uni.chooseLocation({
				success: function (res) {
					_this.whereinfo = res;
					console.log('位置名称：' + res.name);
					console.log('详细地址：' + res.address);
					console.log('纬度：' + res.latitude);
					console.log('经度：' + res.longitude);
				}
			});
		}
	}
};
</script>

<style lang="scss">
.map {
	height: 600rpx;
}
</style>
